/**
 */
package js.impl;

import js.Array;
import js.Date;
import js.Function;
import js.GlobalObject;
import js.Iterator;
import js.JsFactory;
import js.JsPackage;
import js.PatternType;
import js.RegExp;

import js.backbone.BackbonePackage;

import js.backbone.impl.BackbonePackageImpl;

import js.phonegap.PhonegapPackage;

import js.phonegap.impl.PhonegapPackageImpl;

import js.phonegap.methods.MethodsPackage;

import js.phonegap.methods.impl.MethodsPackageImpl;

import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;

import org.eclipse.emf.ecore.impl.EPackageImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Package</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class JsPackageImpl extends EPackageImpl implements JsPackage {
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass globalObjectEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass arrayEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass booleanEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass dateEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass functionEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass iteratorEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass numberEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass objectEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass regExpEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass stringEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EEnum patternTypeEEnum = null;

	/**
	 * Creates an instance of the model <b>Package</b>, registered with
	 * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
	 * package URI value.
	 * <p>Note: the correct way to create the package is via the static
	 * factory method {@link #init init()}, which also performs
	 * initialization of the package, or returns the registered package,
	 * if one already exists.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see org.eclipse.emf.ecore.EPackage.Registry
	 * @see js.JsPackage#eNS_URI
	 * @see #init()
	 * @generated
	 */
	private JsPackageImpl() {
		super(eNS_URI, JsFactory.eINSTANCE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private static boolean isInited = false;

	/**
	 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
	 * 
	 * <p>This method is used to initialize {@link JsPackage#eINSTANCE} when that field is accessed.
	 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #eNS_URI
	 * @see #createPackageContents()
	 * @see #initializePackageContents()
	 * @generated
	 */
	public static JsPackage init() {
		if (isInited) return (JsPackage)EPackage.Registry.INSTANCE.getEPackage(JsPackage.eNS_URI);

		// Obtain or create and register package
		JsPackageImpl theJsPackage = (JsPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof JsPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new JsPackageImpl());

		isInited = true;

		// Obtain or create and register interdependencies
		BackbonePackageImpl theBackbonePackage = (BackbonePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(BackbonePackage.eNS_URI) instanceof BackbonePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(BackbonePackage.eNS_URI) : BackbonePackage.eINSTANCE);
		PhonegapPackageImpl thePhonegapPackage = (PhonegapPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(PhonegapPackage.eNS_URI) instanceof PhonegapPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(PhonegapPackage.eNS_URI) : PhonegapPackage.eINSTANCE);
		MethodsPackageImpl theMethodsPackage = (MethodsPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(MethodsPackage.eNS_URI) instanceof MethodsPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(MethodsPackage.eNS_URI) : MethodsPackage.eINSTANCE);

		// Create package meta-data objects
		theJsPackage.createPackageContents();
		theBackbonePackage.createPackageContents();
		thePhonegapPackage.createPackageContents();
		theMethodsPackage.createPackageContents();

		// Initialize created meta-data
		theJsPackage.initializePackageContents();
		theBackbonePackage.initializePackageContents();
		thePhonegapPackage.initializePackageContents();
		theMethodsPackage.initializePackageContents();

		// Mark meta-data to indicate it can't be changed
		theJsPackage.freeze();

  
		// Update the registry and return the package
		EPackage.Registry.INSTANCE.put(JsPackage.eNS_URI, theJsPackage);
		return theJsPackage;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getGlobalObject() {
		return globalObjectEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getGlobalObject_QualifiedName() {
		return (EAttribute)globalObjectEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getGlobalObject_Pattern() {
		return (EAttribute)globalObjectEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getGlobalObject_Children() {
		return (EReference)globalObjectEClass.getEStructuralFeatures().get(2);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getArray() {
		return arrayEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getBoolean() {
		return booleanEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getDate() {
		return dateEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getFunction() {
		return functionEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getIterator() {
		return iteratorEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getNumber() {
		return numberEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getObject() {
		return objectEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getRegExp() {
		return regExpEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getString() {
		return stringEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EEnum getPatternType() {
		return patternTypeEEnum;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public JsFactory getJsFactory() {
		return (JsFactory)getEFactoryInstance();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isCreated = false;

	/**
	 * Creates the meta-model objects for the package.  This method is
	 * guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void createPackageContents() {
		if (isCreated) return;
		isCreated = true;

		// Create classes and their features
		globalObjectEClass = createEClass(GLOBAL_OBJECT);
		createEAttribute(globalObjectEClass, GLOBAL_OBJECT__QUALIFIED_NAME);
		createEAttribute(globalObjectEClass, GLOBAL_OBJECT__PATTERN);
		createEReference(globalObjectEClass, GLOBAL_OBJECT__CHILDREN);

		arrayEClass = createEClass(ARRAY);

		booleanEClass = createEClass(BOOLEAN);

		dateEClass = createEClass(DATE);

		functionEClass = createEClass(FUNCTION);

		iteratorEClass = createEClass(ITERATOR);

		numberEClass = createEClass(NUMBER);

		objectEClass = createEClass(OBJECT);

		regExpEClass = createEClass(REG_EXP);

		stringEClass = createEClass(STRING);

		// Create enums
		patternTypeEEnum = createEEnum(PATTERN_TYPE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isInitialized = false;

	/**
	 * Complete the initialization of the package and its meta-model.  This
	 * method is guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void initializePackageContents() {
		if (isInitialized) return;
		isInitialized = true;

		// Initialize package
		setName(eNAME);
		setNsPrefix(eNS_PREFIX);
		setNsURI(eNS_URI);

		// Obtain other dependent packages
		BackbonePackage theBackbonePackage = (BackbonePackage)EPackage.Registry.INSTANCE.getEPackage(BackbonePackage.eNS_URI);
		PhonegapPackage thePhonegapPackage = (PhonegapPackage)EPackage.Registry.INSTANCE.getEPackage(PhonegapPackage.eNS_URI);

		// Add subpackages
		getESubpackages().add(theBackbonePackage);
		getESubpackages().add(thePhonegapPackage);

		// Create type parameters

		// Set bounds for type parameters

		// Add supertypes to classes
		arrayEClass.getESuperTypes().add(this.getGlobalObject());
		booleanEClass.getESuperTypes().add(this.getGlobalObject());
		dateEClass.getESuperTypes().add(this.getGlobalObject());
		functionEClass.getESuperTypes().add(this.getGlobalObject());
		iteratorEClass.getESuperTypes().add(this.getGlobalObject());
		numberEClass.getESuperTypes().add(this.getGlobalObject());
		objectEClass.getESuperTypes().add(this.getGlobalObject());
		regExpEClass.getESuperTypes().add(this.getGlobalObject());
		stringEClass.getESuperTypes().add(this.getGlobalObject());

		// Initialize classes and features; add operations and parameters
		initEClass(globalObjectEClass, GlobalObject.class, "GlobalObject", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEAttribute(getGlobalObject_QualifiedName(), ecorePackage.getEString(), "qualifiedName", null, 1, 1, GlobalObject.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEAttribute(getGlobalObject_Pattern(), this.getPatternType(), "pattern", null, 0, 1, GlobalObject.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getGlobalObject_Children(), this.getGlobalObject(), null, "children", null, 0, -1, GlobalObject.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		initEClass(arrayEClass, Array.class, "Array", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(booleanEClass, js.Boolean.class, "Boolean", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(dateEClass, Date.class, "Date", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(functionEClass, Function.class, "Function", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(iteratorEClass, Iterator.class, "Iterator", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(numberEClass, js.Number.class, "Number", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(objectEClass, js.Object.class, "Object", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(regExpEClass, RegExp.class, "RegExp", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(stringEClass, js.String.class, "String", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		// Initialize enums and add enum literals
		initEEnum(patternTypeEEnum, PatternType.class, "PatternType");
		addEEnumLiteral(patternTypeEEnum, PatternType.CREATE);
		addEEnumLiteral(patternTypeEEnum, PatternType.READ);
		addEEnumLiteral(patternTypeEEnum, PatternType.UPDATE);
		addEEnumLiteral(patternTypeEEnum, PatternType.DELETE);
		addEEnumLiteral(patternTypeEEnum, PatternType.LIST);

		// Create resource
		createResource(eNS_URI);
	}

} //JsPackageImpl
